package leetcode_1001_1100;

import java.util.HashMap;
import java.util.Map;

public class LeeCode_1072 {
    public static void main(String[] args) {

    }
    private static int maxEqualRowsAfterFlips(int[][] matrix) {
        Map<String, Integer> map = new HashMap<>();
        for (int[] ints : matrix) {
            StringBuilder key1 = new StringBuilder();
            for (int num : ints) {
                key1.append(num);
            }
            map.put(key1.toString(), map.getOrDefault(key1.toString(), 0) + 1);
            StringBuilder key2 = new StringBuilder();
            for (int num : ints) {
                key2.append(num == 1 ? 0 : 1);
            }
            map.put(key2.toString(), map.getOrDefault(key2.toString(), 0) + 1);
        }
        int ans = 0;
        for (String key : map.keySet()) {
            ans = Math.max(map.get(key), ans);
        }
        return ans;
    }
}
